{ ***  cef_request_handler_capi.h  *** }

    PCefQuotaCallback = ^TCefQuotaCallback;
    PCefAllowCertificateErrorCallback = ^TCefAllowCertificateErrorCallback;
    PCefRequestHandler = ^TCefRequestHandler;

    // Callback structure used for asynchronous continuation of quota requests.
    TCefQuotaCallback = record
        // Base structure.
        base: TCefBase;

        // Continue the quota request. If |allow| is true (1) the request will be
        // allowed. Otherwise, the request will be denied.
        cont: procedure(self: PCefQuotaCallback; allow: Integer); cconv;

        // Cancel the quota request.
        cancel: procedure(self: PCefQuotaCallback); cconv;
    end;


    // Callback structure used for asynchronous continuation of url requests when
    // invalid SSL certificates are encountered.
    TCefAllowCertificateErrorCallback = record
        // Base structure.
        base: TCefBase;

        // Continue the url request. If |allow| is true (1) the request will be
        // continued. Otherwise, the request will be canceled.
  		cont: procedure(self: PCefAllowCertificateErrorCallback; allow: Integer); cconv;
    end;


    // Implement this structure to handle events related to browser requests. The
    // functions of this structure will be called on the thread indicated.
    TCefRequestHandler = record
        // Base structure.
        base: TCefBase;

        // Called on the UI thread before browser navigation. Return true (1) to
        // cancel the navigation or false (0) to allow the navigation to proceed. The
        // |request| object cannot be modified in this callback.
        // cef_load_handler_t::OnLoadingStateChange will be called twice in all cases.
        // If the navigation is allowed cef_load_handler_t::OnLoadStart and
        // cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
        // cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
        // ERR_ABORTED.
        on_before_browse: function(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            frame: PCefFrame;
            request: PCefRequest;
            is_redirect: Integer): Integer; cconv;

        // Called on the IO thread before a resource request is loaded. The |request|
        // object may be modified. To cancel the request return true (1) otherwise
        // return false (0).
        on_before_resource_load: function(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            frame: PCefFrame;
            request: PCefRequest): Integer; cconv;

  		// Called on the IO thread before a resource is loaded. To allow the resource
  		// to load normally return NULL. To specify a handler for the resource return
  		// a cef_resource_handler_t object. The |request| object should not be
  		// modified in this callback.
  		get_resource_handler: function(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            frame: PCefFrame;
            request: PCefRequest): PCefResourceHandler; cconv;

        // Called on the IO thread when a resource load is redirected. The |old_url|
        // parameter will contain the old URL. The |new_url| parameter will contain
        // the new URL and can be changed if desired.
        on_resource_redirect: procedure(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            frame: PCefFrame;
            const old_url: PCefString;
            new_url: PCefString); cconv;

        // Called on the IO thread when the browser needs credentials from the user.
        // |isProxy| indicates whether the host is a proxy server. |host| contains the
        // hostname and |port| contains the port number. Return true (1) to continue
        // the request and call cef_auth_callback_t::cont() when the authentication
        // information is available. Return false (0) to cancel the request.
        get_auth_credentials: function(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            frame: PCefFrame;
            isProxy: Integer;
            const host: PCefString;
            port: Integer;
            const realm, scheme: PCefString;
            callback: PCefAuthCallback): Integer; cconv;

        // Called on the IO thread when JavaScript requests a specific storage quota
        // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
        // origin of the page making the request. |new_size| is the requested quota
        // size in bytes. Return true (1) and call cef_quota_callback_t::cont() either
        // in this function or at a later time to grant or deny the request. Return
        // false (0) to cancel the request.
        on_quota_request: function(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            const origin_url: PCefString;
            new_size: Int64;
            callback: PCefQuotaCallback): Integer; cconv;

        // Called on the UI thread to handle requests for URLs with an unknown
        // protocol component. Set |allow_os_execution| to true (1) to attempt
        // execution via the registered OS protocol handler, if any. SECURITY WARNING:
        // YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
        // OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
        on_protocol_execution: procedure(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            const url: PCefString;
            allow_os_execution: PInteger); cconv;

        // Called on the UI thread to handle requests for URLs with an invalid SSL
        // certificate. Return true (1) and call
        // cef_allow_certificate_error_callback_t:: cont() either in this function or
        // at a later time to continue or cancel the request. Return false (0) to
        // cancel the request immediately. If |callback| is NULL the error cannot be
        // recovered from and the request will be canceled automatically. If
        // CefSettings.ignore_certificate_errors is set all invalid certificates will
        // be accepted without calling this function.
  		on_certificate_error: function(
            self: PCefRequestHandler;
            cert_error: TCefErrorcode;
            const request_url: PCefString;
            callback: PCefAllowCertificateErrorCallback): Integer; cconv;

        // Called on the browser process IO thread before a plugin is loaded. Return
        // true (1) to block loading of the plugin.
        on_before_plugin_load: function(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            const url, policy_url: PCefString;
            info: PCefWebPluginInfo): Integer; cconv;

        // Called on the browser process UI thread when a plugin has crashed.
        // |plugin_path| is the path of the plugin that crashed.
        on_plugin_crashed: procedure(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            const plugin_path: PCefString); cconv;

        // Called on the browser process UI thread when the render process terminates
        // unexpectedly. |status| indicates how the process terminated.
        on_render_process_terminated: procedure(
            self: PCefRequestHandler;
            browser: PCefBrowser;
            status: TCefTerminationStatus); cconv;
    end;


